﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Project.Domain.AggregateModels;
using System;
using System.Collections.Generic;
using System.Text;

namespace Project.Infrastructure.Models.Mapping
{
    public class BPFileMap
        : IEntityTypeConfiguration<BPFile>
    {
        public void Configure(EntityTypeBuilder<BPFile> builder)
        {
            //Table.
            builder.ToTable("BPFile");
            //Key.
            builder.HasKey("Id");
            //Properties.
            builder.Property(t => t.Id)
                .HasColumnName("Id")
                .IsRequired();
            builder.Property(t => t.ProjectId)
               .HasColumnName("ProjectId")
               .IsRequired();
            builder.Property(t => t.FileName)
               .HasColumnName("FileName")
               .HasMaxLength(255)
               .IsUnicode(true)
               .IsRequired();
            builder.Property(t => t.FormatPath)
               .HasColumnName("FormatPath")
               .HasMaxLength(255)
               .IsUnicode(true)
               .IsRequired();
            builder.Property(t => t.OriginPath)
               .HasColumnName("OriginPath")
                .HasMaxLength(255)
               .IsUnicode(true)
               .IsRequired();
            builder.Property(t => t.CreateTime)
              .HasColumnName("CreateTime")
              .IsRequired();
            //Relations
        }
    }
}
